require(['../config/requireconfig'],function(config){
	//根据需要添加
	require(['jquery','common/pccommons'],function($,com){
		
        com.init({headerPos:{menu:2,sub:1}});
		var pageLogic = new PageLogic($,com);
		pageLogic.init();

	});
});
var PageLogic = function($,com){
	return{
		init:function(){
			var _this = this;
			_this.genByInfo();
			_this.bindEvent();
		},
		genByInfo:function(){
			var _this = this;
			var res = {};
			var val = $("#inpCategroy").val();
			if(val){
				res.categoryName = val;
			}
			com.ajax({
				url:"/partsCategoryInfosDirect.json",
				data:res,
				success:function(res){
					_this.genList(res.data);
				}
			})
		},
		bindEvent:function(){
			var _this = this;
			$("#btnSerch").on("click",function(){
				_this.genByInfo();
			});
		},
		genList:function(lst){
			var html = "";
			$(lst).each(function(idx,obj){
				if(idx % 4 == 3){
					html += '<li class="lst" tg="' + obj.id + '"><img src="' + (com._Options.domain + obj.imageUrl) + '"><p>' + obj.categoryName + '</p></li>';
				}else{
					html += '<li tg="' + obj.id + '"><img src="' + (com._Options.domain + obj.imageUrl) + '"><p>' + obj.categoryName + '</p></li>';
				}
			});
			$(".category-list").html(html);
			$(".category-list").find("li").on("click",function(){
				window.open("/prodCategorySec.htm?categoryid=" + $(this).attr("tg"));
			});
		}
	}
}